<?php
/**
 * @package     Redmap.Frontend
 * @subpackage  redMAP Controller
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

function PhuongBuildRoute($query)
{
	$segments = array();

	if (isset($query['task']))
	{
		$segments[] = $query['task'];
		unset($query['task']);
	}

	if (isset($query['id']))
	{
		$segments[] = $query['id'];
		unset($query['id']);
	}

	return $segments;
}

function PhuongParseRoute($segments)
{
	$vars = array();

	// View is always the first element of the array
	$count = count($segments);

	if ($count)
	{
		$count --;
		$segment = array_shift($segments);
		$vars[] = $segment;
	}

	return $vars;
}
